// 淘宝适配方案
function remRefresh() {
  let clientWidth = document.documentElement.clientWidth;
  // 将屏幕等分成10份
  let rem = clientWidth / 10;
  document.documentElement.style.fontSize = rem + 'px';
  document.body.style.fontSize = '12px'
}

window.addEventListener('pageshow', () => {
  remRefresh()
})

  // 函数防抖
let timeoutId;
window.addEventListener('resize', () => {
  timeoutId && clearTimeout(timeoutId)
  timeoutId = setTimeout(() => {
    remRefresh()
  }, 300)
})